// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "Misc/AssetRegistryInterface.h"
#include "HotPakerFileLib.generated.h"

struct FAssetData;
class FAssetPackageData;

class FPakerFileSearchVisitor : public IPlatformFile::FDirectoryVisitor
{
public:
	virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) override
	{
		if (bIsDirectory)
		{
			Directories.Add(FilenameOrDirectory);
		}
		return true;
	}

	TArray<FString> Directories;
};
/**
 *
 */
UCLASS()
class HOTPAKER_API UHotPakerFileLib : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:

	UFUNCTION(BlueprintCallable)
		static FString GetProjectName();

	UFUNCTION(BlueprintCallable)
		static FString GetUnrealPakBinary();

	UFUNCTION(BlueprintCallable)
		static FString GetUE4CmdBinary();

	UFUNCTION(BlueprintCallable)
		static TArray<FString> GetAllPlatforms();

	UFUNCTION(BlueprintCallable)
		static FString ConverPackagePathToFullPath(FString PackagePath);

	UFUNCTION(BlueprintCallable)
		static FString ConverFullPathToPackagePath(FString FullPath);

	UFUNCTION(BlueprintCallable)
		static TArray<FName> GetAssetDependencies(const FName& InPackageName);

	UFUNCTION(BlueprintCallable)
		static void GetAssetAllDependencies(const FName& InPackageName, TArray<FName>& OutDependencies);

	UFUNCTION(BlueprintCallable)
		static void GetAssetsAllDependencies(const TArray<FName>& InPackageNames, TArray<FName>& OutDependencies);

	UFUNCTION(BlueprintCallable)
		static bool ConverPackageNameToSavePath(const FName& InPackageName, const FString& InSavePath, const FString& InPlatform, FString& OutSavePath);

	//UFUNCTION(BlueprintCallable)
		static bool GetAssetDataByPackageName(const FName& InPackageName, FAssetData& AssetData);

	//UFUNCTION(BlueprintCallable)
		static bool GetAssetDatasByPackageNames(const TArray<FName>& InPackageNames, TArray<FAssetData>& OutAssetDatas);

		static const FAssetPackageData* GetAssetPackageDataByPackageName(const FName& InPackageName);

public:

	static const FName AssetRegistryName;

};
